package com.weihua.service;

import com.weihua.bo.PlcBo;
import com.weihua.bo.PlcDataBo;
import com.weihua.conver.PlcDataConvert;
import com.weihua.dao.PlcDataMapper;
import com.weihua.po.PlcDataPo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.stream.Collectors;

@Service
@Transactional
public class PlcDataService extends BaseServiceImpl<PlcDataBo, PlcDataPo, PlcDataMapper>{

    @Autowired
    private PlcDataMapper plcDataMapper;
    @Override
    protected PlcDataMapper getMapper() {
        return plcDataMapper;
    }

    @Override
    protected PlcDataPo transBo2Po(PlcDataBo bo) {
        return PlcDataConvert.T.transBo2Po(bo);
    }

    @Override
    protected PlcDataBo transPo2Bo(PlcDataPo po) {
        return PlcDataConvert.T.transPo2Bo(po);
    }

    public PlcDataBo transPBo2Bo(PlcBo bo){
        return PlcDataConvert.T.transPBO2Bo(bo);
    }

    public List<PlcDataBo> getBos(List<PlcBo> bos){
        return bos.parallelStream().map(this::transPBo2Bo).collect(Collectors.toList());
    }
}
